#include("../template/_layout.html")
#@layout()

#define content()
<div class="container" style="margin-top: 30px;">
#if(cacheSize>0)
<div class="container alert alert-success" style="margin-top: 10px;" role="alert">当前数据库待写入数据剩余：#(cacheSize)</div>
#end
	<form action="/search/start" method="post" class="form-inline">
		<div class="form-group">
			<label for="keywordInput">关键字</label>
			<input type="text" name="keyword" value="" class="form-control" id="keywordInput" style="width:auto">
		</div>
		<button type="submit" class="btn btn-default">增加</button>
		<button type="button" class="btn btn-default" onclick="location='/search'">刷新</button>
	</form>
	<div style="margin-top: 10px;"></div>
	<table class="table">
	    <thead>
		<tr>
			<th>序号</th>
			<th>关键字</th>
			<th>状态</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		#for(info:queueInfo)
		<tr>
			<td>#(for.count)</td>
			<td>#(info)</td>
			<td>
			#if(for.first)
			    #if(status.status==0)
			    正在处理（#(status.sum)／#(status.total)）
			    #else
			    正在停止
			    #end
			#else
			    等待
			#end
			</td>
			<td>
            #if(for.first)
                #if(status.status==0)
                <a class="btn btn-danger" href="/search/stop">停止</a>
                #end
            #else
                <a class="btn btn-info" href="/search/delete?id=#(for.count-2)">取消</a>
            #end
			</td>
		</tr>
		#end
		</tbody>
	</table>
</div>
#end